<app-editor [(ngModel)]="data" (ngModelChange)="basicForm.patchValue($event)" [submitting]="submitting"
            (submit)="submit()">

  <nz-collapse [formGroup]="basicForm">
    <nz-collapse-panel nzHeader="基本信息" nzActive>
      <nz-form-item>
        <nz-form-label [nzSpan]="5">名称</nz-form-label>
        <nz-form-control [nzSpan]="12" nzErrorTip="">
          <input nz-input formControlName="name" required/>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSpan]="5">组态</nz-form-label>
        <nz-form-control [nzSpan]="12" nzErrorTip="">
          <app-choose-hmi formControlName="hmi" [showClear]="true"></app-choose-hmi>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSpan]="5">标签</nz-form-label>
        <nz-form-control [nzSpan]="12" nzErrorTip="">
          <nz-select nzAllowClear nzMode="tags" [nzTokenSeparators]="[',', '，', ';', ' ']" formControlName="tags"
                     nzSize="small" (ngModelChange)="change()" nzPlaceHolder="以逗号间隔"></nz-select>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSpan]="5">生产厂家</nz-form-label>
        <nz-form-control [nzSpan]="12" nzErrorTip="">
          <input nz-input formControlName="manufacturer"/>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSpan]="5">型号</nz-form-label>
        <nz-form-control [nzSpan]="12" nzErrorTip="">
          <input nz-input formControlName="version"/>
        </nz-form-control>
      </nz-form-item>

    </nz-collapse-panel>

    <nz-collapse-panel nzHeader="协议适配" nzActive>
      <app-edit-protocol formControlName="protocol" (codes)="onCodes($event)"></app-edit-protocol>
    </nz-collapse-panel>

    <nz-collapse-panel nzHeader="数据点" nzActive>
      <app-edit-points formControlName="points" [codes]="codes"></app-edit-points>
    </nz-collapse-panel>

    <nz-collapse-panel nzHeader="定时采集" nzActive>
      <app-edit-pollers formControlName="pollers" [codes]="codes"></app-edit-pollers>
    </nz-collapse-panel>

    <nz-collapse-panel nzHeader="公式计算" nzActive>
      <app-edit-calculators formControlName="calculators"></app-edit-calculators>
    </nz-collapse-panel>

    <nz-collapse-panel nzHeader="控制命令" nzActive>
      <app-edit-commands formControlName="commands"></app-edit-commands>
    </nz-collapse-panel>

    <nz-collapse-panel nzHeader="数据检查" nzActive>
      <app-edit-alarms formControlName="alarms"></app-edit-alarms>
    </nz-collapse-panel>

  </nz-collapse>


</app-editor>
